package com.wfh.rpc.protocal;

import lombok.Getter;

/**
 * @Title: ProtocalMessageEnum
 * @Author wangfenghuan
 * @Package com.wfh.rpc.protocal
 * @Date 2025/10/14 21:02
 * @description: 协议枚举
 */
@Getter
public enum ProtocolMessageStatusEnum {

    /**
     * 协议枚举
     */
    OK("ok", 20),
    BAD_REQUEST("badRequest", 40),
    BAD_RESPONSE("badResponse", 50);

    private final String text;

    private final int value;

    ProtocolMessageStatusEnum(String text, int value){
        this.text = text;
        this.value = value;
    }

    public static ProtocolMessageStatusEnum getByValue(int value){
        for (ProtocolMessageStatusEnum protocalMessageEnum : ProtocolMessageStatusEnum.values()) {
            if (protocalMessageEnum.value == value){
                return protocalMessageEnum;
            }
        }
        return null;
    }

}
